---
title: Bitbucket
description: BitbucketTools enables agents to interact with Bitbucket repositories for managing code, pull requests, and issues.
---

## Example

The following agent can manage Bitbucket repositories:

```python
from agno.agent import Agent
from agno.tools.bitbucket import BitbucketTools

agent = Agent(
    instructions=[
        "You are a Bitbucket repository management assistant",
        "Help users manage their Bitbucket repositories, pull requests, and issues",
        "Provide clear information about repository operations",
        "Handle errors gracefully and suggest solutions",
    ],
    tools=[BitbucketTools(
        workspace="your-workspace",
        repo_slug="your-repository"
    )],
)

agent.print_response("List all pull requests for this repository", stream=True)
```

## Toolkit Params

| Parameter     | Type            | Default               | Description                                                 |
| ------------- | --------------- | --------------------- | ----------------------------------------------------------- |
| `server_url`  | `str`           | `"api.bitbucket.org"` | Bitbucket server URL (for Bitbucket Server instances).      |
| `username`    | `Optional[str]` | `None`                | Bitbucket username. Uses BITBUCKET_USERNAME if not set.     |
| `password`    | `Optional[str]` | `None`                | Bitbucket app password. Uses BITBUCKET_PASSWORD if not set. |
| `token`       | `Optional[str]` | `None`                | Access token. Uses BITBUCKET_TOKEN if not set.              |
| `workspace`   | `Optional[str]` | `None`                | Bitbucket workspace name (required).                        |
| `repo_slug`   | `Optional[str]` | `None`                | Repository slug name (required).                            |
| `api_version` | `str`           | `"2.0"`               | Bitbucket API version to use.                               |

## Toolkit Functions

| Function                   | Description                                             |
| -------------------------- | ------------------------------------------------------- |
| `get_issue`                | Get details of a specific issue by ID.                  |
| `get_issues`               | List all issues in the repository.                      |
| `create_issue`             | Create a new issue in the repository.                   |
| `update_issue`             | Update an existing issue.                               |
| `get_pull_request`         | Get details of a specific pull request.                 |
| `get_pull_requests`        | List all pull requests in the repository.               |
| `create_pull_request`      | Create a new pull request.                              |
| `update_pull_request`      | Update an existing pull request.                        |
| `get_pull_request_diff`    | Get the diff/changes of a pull request.                 |
| `get_pull_request_commits` | Get commits associated with a pull request.             |
| `get_repository_info`      | Get detailed information about the repository.          |
| `get_branches`             | List all branches in the repository.                    |
| `get_commits`              | List commits in the repository.                         |
| `get_file_content`         | Get the content of a specific file from the repository. |

You can use `include_tools` or `exclude_tools` to modify the list of tools the agent has access to. Learn more about [selecting tools](/concepts/tools/selecting-tools).

## Developer Resources

- View [Tools Source](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/bitbucket.py)
- [Bitbucket API Documentation](https://developer.atlassian.com/bitbucket/api/2/reference/)
